package com.example.demo.utils

import org.springframework.context.annotation.Configuration
import javax.servlet.http.HttpSessionEvent
import javax.servlet.http.HttpSessionListener
@Configuration
class SessionListener : HttpSessionListener {

    private val myc = MySessionContext.getInstance()

    override fun sessionCreated(httpSessionEvent: HttpSessionEvent?) {
        val session = httpSessionEvent!!.session
        myc.addSession(session)
    }

    override fun sessionDestroyed(httpSessionEvent: HttpSessionEvent?) {
        val session = httpSessionEvent!!.session
        myc.delSession(session)
    }

}
